<cfcomponent displayname="ColdBox Object Factory Plugin" extends="coldbox.system.plugin" 
	cache="true" cacheTimeout="1"
	hint="I manage creation of class instances factory style.">
<cfset variables.sosFactoryVersion = "1.5.0.2">
<cffunction name="init" access="public" returntype="any" output="false">
	<cfargument name="controller" type="any" required="true">
	
	<cfscript>
	Super.Init(ARGUMENTS.controller);
	setpluginName("sosFactory");
	setpluginVersion(VARIABLES.sosFactoryVersion);
	setpluginDescription("This is the sosFactory object creation library.");
	
	arguments.environment = "ColdBox";
	variables.sosFactory = CreateObject("component","factory").init(
		environment:"ColdBox"
	);
	
	return this;
	</cfscript>
</cffunction>

<cffunction name="onMissingMethod" access="public" returntype="any" output="false">
	
	<cfset var result = 0>
	<cfset var method = arguments.missingMethodName>
	<cfset var args = StructNew()>
	
	<cfset args = arguments.missingMethodArguments>
	
	<cfinvoke
		returnvariable="result"
		component="#variables.sosFactory#"
		method="#method#"
		argumentCollection="#args#"
	>
	
	<cfif isDefined("result")>
		<cfreturn result>
	</cfif>
</cffunction>

</cfcomponent>